package comcy.pj.module.controller;

import comcy.pj.module.pojo.RequestParameter;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**访问时：http://localhost/doParam01?name=mvc
 * 直接量方式(/doParam01)
 */

@RestController
public class ParamObjectController {
    @GetMapping("/doParam01")
    public String doMethodParam(String name){
        return "request Params "+name;
    }


    //访问时：http://localhost/doParam02?name=mvc&name=jack
    @RequestMapping("/doParam02")
    public String doMethodParam(RequestParameter param){//方法中使用pojo对象接收方法参数
        return "request params  "+param.toString();

    }

    //访问时：http://localhost/doParam03?name=mvc
    //基于map对象接收请求参数
    @GetMapping("/doParam03")
    public String doMethodParam(@RequestParam Map<String,Object> param){
        return "request params"+param.toString();
    }


}
